#include "stdafx.h"
#include "TableList.h"
#include "InstanceTouch.h"
DECL_INSTANCE_TOUCH(ETouch_TableList);

struct TableListrReflectionRegister
{
	TableListrReflectionRegister()
	{
		REGISTER_REFLECTION_MEMBER(TableListItem,m_iID,INVALID_ID).Editor_SetAsPrimaryKey();
		REGISTER_REFLECTION_MEMBER(TableListItem,m_sDisplayName,std::string("DefaultName")).Editor_SetAsDisplayName();

		GlobalClassManager::Instance().RegisterClass(TableListItem::s_GetReflection(),eDefaultDef_TableList);
		GlobalDefManager::Instance().RegisterDefManger(&TableListManager::Instance());

	}
}__tablelistrreflectionregister;


rewrite void TableListManager::OnArchieveReaded()
{
	__TableListManager::OnArchieveReaded();
	Clear();
	std::vector<DefMangerBase*> vManagers;
	GlobalDefManager::Instance().EnumerateDefManagers( vManagers );
	for(uint32 ii=0;ii<vManagers.size();ii++)
	{
		DefMangerBase* pManager=vManagers[ii];
		CClass& rClass=pManager->GetReflection();

		TableListItem*pNewItem=new TableListItem();
		pNewItem->m_iID=MakeClassID(pManager->GetGoupID(),pManager->GetSubID());
		pNewItem->m_sDisplayName=rClass.GetLocalizedName();
		this->AddItem(pNewItem->m_iID,pNewItem);
	}

}